import { reactive } from "vue";
import {
  IFormModuleType,
  IFormConfigType
} from "@/components/form-module/type/type";
import { IShowTableConfigType } from "@/components/show-table/type/type";
export const queryFormItems: IFormModuleType[] = [
  {
    param: "name",
    label: "用户名",
    placeholder: "请输入用户名",
    type: "input"
  },
  {
    param: "realname",
    label: "真实姓名",
    placeholder: "请输入真实姓名",
    type: "input"
  },
  {
    param: "cellphone",
    label: "联系方式",
    placeholder: "请输入联系方式",
    type: "input"
  },
  {
    param: "enable",
    label: "用户状态",
    type: "select",
    placeholder: "请选择用户状态",
    selectOptions: [
      {
        label: "启用",
        value: 1
      },
      {
        label: "禁用",
        value: 0
      }
    ]
  },
  {
    param: "createAt",
    label: "创建时间",
    type: "datePicker",
    colLayout: {
      xl: 8,
      lg: 8,
      md: 16,
      sm: 24,
      xs: 24
    },
    datePickerProp: {
      type: "daterange",
      rangeSeparator: "至",
      startPlaceholder: "开始时间",
      endPlaceholder: "结束时间"
    }
  }
];

export const userListTableConfig: IShowTableConfigType[] = [
  {
    prop: "name",
    label: "用户名"
  },
  {
    prop: "realname",
    label: "真实姓名"
  },
  {
    prop: "cellphone",
    label: "联系方式"
  },
  {
    prop: "createAt",
    label: "创建时间"
  },
  {
    prop: "updateAt",
    label: "更新时间"
  },
  {
    prop: "enable",
    label: "状态"
  },
  {
    prop: "handle",
    label: "操作"
  }
];

export const dialogFormItems: IFormModuleType[] = [
  {
    param: "name",
    label: "用户名",
    type: "input",
    placeholder: "请输入用户名",
    colLayout: {
      span: 24
    }
  },
  {
    param: "realname",
    label: "真实姓名",
    type: "input",
    placeholder: "请输入真实姓名",
    colLayout: {
      span: 24
    }
  },
  {
    param: "password",
    label: "密码",
    type: "input",
    isHidden: false,
    placeholder: "请输入密码",
    colLayout: {
      span: 24
    }
  },
  {
    param: "cellphone",
    label: "联系方式",
    type: "input",
    placeholder: "请输入联系方式",
    colLayout: {
      span: 24
    }
  },
  {
    param: "roleId",
    label: "用户角色",
    type: "select",
    placeholder: "请选择用户角色",
    selectOptions: [],
    colLayout: {
      span: 24
    }
  },
  {
    param: "departmentId",
    label: "部门",
    type: "select",
    placeholder: "请选择部门",
    selectOptions: [],
    colLayout: {
      span: 24
    }
  }
];

export const dialogFormConfig: IFormConfigType = reactive({
  rules: {
    name: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
    realname: [
      { required: true, message: "真实姓名不能为空", trigger: "blur" }
    ],
    password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
    cellphone: [
      { required: true, message: "联系方式不能为空", trigger: "blur" }
    ],
    roleId: [{ required: true, message: "请选择用户角色", trigger: "blur" }],
    departmentId: [{ required: true, message: "请选择部门", trigger: "blur" }]
  }
});
